<template>
  <div id="car-supplement"
    v-loading="fullLoading"
    element-loading-text="拼命加载中"
    element-loading-spinner="el-icon-loading">
    <div class="back" @click="back">
      <el-tooltip class="item" effect="dark" content="返回上一页" placement="top">
        <el-button type="primary" icon="el-icon-back" circle></el-button>
      </el-tooltip>
    </div>

    <div class="title">
      <v-title :title="title + '项目信息录入'"></v-title>
    </div>

    <!-- <v-condition></v-condition> -->

    <!-- <div class="baseTable marT">
      <el-button type="primary">项目基础信息</el-button>
      <el-row :gutter="10" v-if="result.base_info" class="relative">
        <el-col
          :span="6"
          v-for="item in baseTable"
          :key="item"
          class="marginItem"
          v-show="item !== 'editStatus'">
          <el-badge value="系统数据" :hidden="!result['base_info'][0][item].is_disabled" class="item">
          <el-card shadow="always" class="form-inline">
            <div class="title">{{ item }}: </div>
            <div class="flex-inline">
              <template v-if="!result.base_info[0].editStatus">
                <div class="flex-look" v-if="item !== '交付中心'">
                  {{ result['base_info'][0][item].value }}
                </div>
                <div class="flex-look" v-else>
                  <template v-if="Array.isArray(result.base_info[0][item].value)">
                    <span v-if="result.base_info[0][item].value.length > 1">{{ result.base_info[0][item].value.join(',') }}</span>
                    <span v-else-if="result.base_info[0][item].value.length === 1">{{ result.base_info[0][item].value[0] }}</span>
                  </template>
                  <span v-else></span>
                </div>
              </template>
              <template v-else>
                <span class="must" v-if="!result['base_info'][0][item].is_disabled">*</span>
                <el-select :disabled="!result['base_info'][0][item].has_perm||result['base_info'][0][item].is_disabled" multiple v-if="item === '交付中心'" v-model="result['base_info'][0][item].value" :placeholder="item">
                  <el-option
                    v-for="item2 in centerOptions"
                    :key="item2.value"
                    :label="item2.label"
                    :value="item2.value">
                  </el-option>
                </el-select>
                <el-select
                  v-else-if="item === 'QA' || item === '架构师' || item === '测试经理' || item === '研发经理' || item === 'AM' || item === 'PM' || item === '销售'"
                  v-model="result['base_info'][0][item].value"
                  :disabled="!result['base_info'][0][item].has_perm||result['base_info'][0][item].is_disabled"
                  filterable
                  remote
                  placeholder="请输入owner"
                  :remote-method="remoteMethod"
                  :loading="loading"
                  @change="change"
                  >
                  <el-option
                    v-for="item in options"
                    :key="item.value"
                    :label="item.label + ' ' + item.value"
                    :value="item.label + ' ' + item.value"
                    >
                      <span style="float: left">{{ item.label }}</span>
                      <span style="float: right; color: #8492a6; font-size: 13px">{{ item.value }}</span>
                  </el-option>
                </el-select>
                <template v-else>
                  <el-input
                    v-if="item !== 'editStatus'"
                    :disabled="!result['base_info'][0][item].has_perm||result['base_info'][0][item].is_disabled"
                    v-model="result['base_info'][0][item].value"
                    :type="result['base_info'][0][item].type === 'percent' || result['base_info'][0][item].type === 'number' ? 'number' : ''"
                    :step="result['base_info'][0][item].type === 'percent' ? '0.1' : ''"
                    :placeholder="item">
                  </el-input>
                </template>
              </template>
            </div>
          </el-card>
          </el-badge>
        </el-col>

        <div class="baseButton">
          <el-button class="button" size="mini" @click="toEdit('base_info', 0)" v-show="!result.base_info[0]['editStatus']" type="primary" round>编辑</el-button>
          <el-button class="button" size="mini" @click="saveResult('base_info', 0)" v-show="result.base_info[0]['editStatus']" type="success" round>保存</el-button>
          <el-button class="button" size="mini" @click="cancel('base_info', 0)" v-show="result.base_info[0]['editStatus']" type="warning" round>取消</el-button>
        </div>
      </el-row>
    </div> -->

    <div class="tab-box marT">
      <el-tabs class="marT" v-model="activeName">
        <el-tab-pane label="项目基础信息" name="0">
          <el-table
            :border="true"
            :header-cell-style="{background:'rgb(48, 65, 86)'}"
            :data="result.base_info"
            style="width: 90%"
          >
            <el-table-column
              label="基本信息"
              align="center"
            >
              <template slot-scope="scope">
                <div>{{ scope.row.examine_item }}</div>
              </template>
            </el-table-column>
            <el-table-column
              label="责任人"
              align="center"
              prop="owner"
            >
              <template slot-scope="scope">
                <div>{{ scope.row.owner.length ? scope.row.owner.map(item => item.label).join(',') : '' }}</div>
              </template>
            </el-table-column>
            <!--<el-table-column
              label="描述"
              align="center"
              prop="description"
            >
            </el-table-column>
            <el-table-column
              label="目标"
              align="center"
              prop="target_value"
            >
            </el-table-column>-->

            <el-table-column
              label="数据"
              align="center"
              width="400"
            >
              <template slot-scope="scope">
                <template v-if="!scope.row.is_disabled">
                  <div v-if="scope.row.editStatus">
                    <template v-if="scope.row.examine_item === '交付中心'">
                      <el-select :disabled="!scope.row.has_perm||scope.row.is_disabled||!scope.row.is_apply" multiple v-model="scope.row.value" :placeholder="scope.row.examine_item">
                        <el-option
                          v-for="item2 in centerOptions"
                          :key="item2.value"
                          :label="item2.label"
                          :value="item2.value">
                        </el-option>
                      </el-select>
                    </template>
                    <template v-else>
                      <el-input
                        placeholder="请输入实际值"
                        suffix-icon="el-icon-edit"
                        v-model="scope.row.value"
                        :disabled="!scope.row.is_apply"
                        :type="scope.row.type === 'percent' || scope.row.type === 'number' ? 'number' : ''"
                        :step="scope.row.type === 'percent' ? '0.1' : ''">
                      </el-input>
                    </template>
                  </div>
                  <div v-else>
                    <template v-if="scope.row.examine_item === '交付中心'">
                      <div class="flex-look">
                        <template v-if="Array.isArray(scope.row.value)">
                          <span v-if="scope.row.value.length > 1">{{ scope.row.value.join(',') }}</span>
                          <span v-else-if="scope.row.value.length === 1">{{ scope.row.value[0] }}</span>
                        </template>
                        <span v-else></span>
                      </div>
                    </template>

                    <div v-else>{{ scope.row.value }}</div>
                  </div>
                </template>

                <template v-else>
                  <div>{{ scope.row.value }}</div>
                  <div v-if="scope.row.is_disabled" class="auto" style="left: 330px">系统数据</div>
                </template>
              </template>
            </el-table-column>

            <!--<el-table-column
              label="是否适用"
              align="center"
            >
              <template slot-scope="scope">
                <el-select :disabled="!scope.row.editStatus" v-model="scope.row.is_apply" placeholder="是否适用">
                  <el-option
                    v-for="item in optionsUse"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select>
              </template>
            </el-table-column>-->

            <!--<el-table-column
              label="说明"
              align="center"
            >
              <template slot-scope="scope" v-if="!scope.row.is_apply">
                <el-input
                 :disabled="!scope.row.editStatus"
                  type="textarea"
                  maxlength="50"
                  autosize
                  placeholder="请输入说明"
                  v-model="scope.row.not_apply_state">
                </el-input>
              </template>
            </el-table-column>-->

            <el-table-column
              label="操作"
              align="center"
            >
              <template slot-scope="scope">
                <div>
                  <el-button :disabled="scope.row.examine_item === '交付中心' || !scope.row.has_perm || scope.row.is_disabled" class="button" size="mini" @click="toEdit('base_info', scope.$index)" v-show="!scope.row.editStatus" type="primary" round>编辑</el-button>
                  <el-button class="button" size="mini" @click="saveResult('base_info', scope.$index)" v-show="scope.row.editStatus" type="success" round>保存</el-button>
                  <el-button class="button" size="mini" @click="cancel('base_info', scope.$index)" v-show="scope.row.editStatus" type="warning" round>取消</el-button>
                </div>
              </template>
            </el-table-column>

          </el-table>

          <el-table
            :border="true"
            :header-cell-style="{background:'rgb(48, 65, 86)'}"
            :data="result.project_info"
            :span-method="objectSpanMethod2"
            style="width:90%"
            >
            <el-table-column
              label="阶段"
              align="center"
            >
              <template  slot-scope="scope" >
                  <div v-if="scope.$index === 0"> 需求阶段</div>
                  <div v-if="scope.$index === 6"> 设计阶段</div>
              </template>
            </el-table-column>

            <el-table-column
              label="Item"
              align="center"
            >
              <template slot-scope="scope">
                <div>{{ scope.row.name }}</div>
              </template>
            </el-table-column>

            <el-table-column
              label="内容"
              align="center"
            >
              <template slot-scope="scope" >
                <div v-if="scope.row.name === '更新时间'">{{result['project_info'][12].value}}</div>
                <div v-else-if="scope.row.name === '设计文档裁剪结果'"></div>
                <div v-else-if="scope.row.name === '管理方法'"></div>
                <div v-else-if="scope.row.name === '需求管理方式 (PMS或者其他需求管理平台)'"></div>
                <div v-else>
                  <el-select
                    :disabled="!scope.row.editStatus"
                    v-model="scope.row.value"
                    placeholder="请选择"
                    @change="chengeselectFn($event,scope.$index,scope.row)">
                    <el-option
                      v-for="item in options1"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
                </div>
              </template>

            </el-table-column>

            <el-table-column
              label="说明"
              align="center"
              width="330"
            >

              <template slot-scope="scope" v-if="scope.row.name != '更新时间' && scope.row.name != '架构设计文档' && scope.row.name != '概要设计文档' && scope.row.name != '详细设计文档'">

                  <el-input
                  v-if="scope.row.value !='是'"
                 :disabled="!scope.row.editStatus"
                  type="textarea"
                  maxlength="1000"
                  autosize
                  placeholder="请输入说明"
                  v-model="scope.row.description">
                  </el-input>


              </template>
            </el-table-column>

            <el-table-column
              label="操作"
              align="center"
            >
              <template slot-scope="scope">
                <div>
                  <el-button :disabled="!scope.row.has_perm || scope.row.is_disabled" class="button" size="mini" @click="toEdit('project_info', scope.$index)" v-show="!scope.row.editStatus" type="primary" round>编辑</el-button>
                  <el-button class="button" size="mini" @click="saveResult1('project_info', scope.$index)" v-show="scope.row.editStatus" type="success" round>保存</el-button>
                  <el-button class="button" size="mini" @click="cancel('project_info', scope.$index)" v-show="scope.row.editStatus" type="warning" round>取消</el-button>
                </div>
              </template>
            </el-table-column>
          </el-table>

        </el-tab-pane>

        <el-tab-pane label="进度风险" name="1">
          <el-table
            :border="true"
            :header-cell-style="{background:'rgb(48, 65, 86)'}"
            :data="result.progress_risk"
            >
            <el-table-column
              label="考核项"
              align="center"
            >
              <template slot-scope="scope">
                <div>
                  <span>{{ scope.row.examine_item }}</span>
                </div>
              </template>
            </el-table-column>
            <el-table-column
              label="责任人"
              align="center"
              prop="owner"
            >
              <template slot-scope="scope">
                <!-- <div v-if="scope.row.editStatus">
                  <el-select v-model="scope.row.owner" placeholder="请选择owner">
                    <el-option
                      v-for="item in scope.row.owner_list"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
                </div> -->
                <div>{{ scope.row.owner.length ? scope.row.owner.map(item => item.label).join(',') : '' }}</div>
              </template>
            </el-table-column>
            <el-table-column
              label="描述"
              align="center"
              prop="description"
            >
            </el-table-column>
            <el-table-column
              label="目标"
              align="center"
              prop="target_value"
            >
            </el-table-column>

            <el-table-column
              label="数据"
              align="center"
              width="400"
            >
              <template slot-scope="scope">
                <template v-if="!scope.row.is_disabled">
                  <div v-if="scope.row.editStatus">
                    <div v-if="scope.row.type === 'date'">
                      <el-date-picker
                        v-model="scope.row.value"
                        type="date"
                        :disabled="!scope.row.is_apply"
                        format="yyyy 年 MM 月 dd 日"
                        value-format="yyyy-MM-dd"
                        placeholder="请选择日期">
                      </el-date-picker>
                    </div>
                    <div v-else-if="scope.row.type === 'status'">
                      <el-select :disabled="!scope.row.is_apply" v-model="scope.row.value" placeholder="请选择验收状态">
                        <el-option
                          v-for="item in checkAcceptOption"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value"
                          >
                        </el-option>
                      </el-select>
                    </div>
                    <div v-else-if="scope.row.type === 'risk'">
                      <el-select :disabled="!scope.row.is_apply" v-model="scope.row.value" placeholder="请选择风险等级">
                        <el-option
                          v-for="item in riskOption"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value"
                          >
                        </el-option>
                      </el-select>
                    </div>
                    <div v-else-if="scope.row.type === 'percent'">
                      <el-input
                        placeholder="请输入分子"
                        suffix-icon="el-icon-edit"
                        v-model="scope.row.molecule"
                        :disabled="!scope.row.is_apply"
                        :type="scope.row.type === 'percent' || scope.row.type === 'number' ? 'number' : ''"
                        :step="scope.row.type === 'percent' ? '0.1' : ''">
                      </el-input>
                      <el-input
                        style="margin-top: 5px;margin-bottom: 5px;"
                        placeholder="请输入分母"
                        suffix-icon="el-icon-edit"
                        v-model="scope.row.denominator"
                        :disabled="!scope.row.is_apply"
                        :type="scope.row.type === 'percent' || scope.row.type === 'number' ? 'number' : ''"
                        :step="scope.row.type === 'percent' ? '0.1' : ''">
                      </el-input>
                      <div >{{ scope.row.value }}</div>
                    </div>
                    <el-input
                      v-else
                      placeholder="请输入实际值"
                      suffix-icon="el-icon-edit"
                      v-model="scope.row.value"
                      :disabled="!scope.row.is_apply"
                      :type="scope.row.type === 'percent' || scope.row.type === 'number' ? 'number' : ''"
                      :step="scope.row.type === 'percent' ? '0.1' : ''">
                    </el-input>

                  </div>
                  <div v-else>{{ scope.row.value }}</div>
                </template>

                <template v-else>
                  <div>{{ scope.row.value }}</div>
                  <el-tooltip v-if="scope.row.is_disabled" class="item" effect="light" content="自动获取" placement="top">
                    <div class="auto">系统数据</div>
                  </el-tooltip>
                </template>
              </template>
            </el-table-column>

            <el-table-column
              label="是否适用"
              align="center"
            >
              <template slot-scope="scope">
                <el-select :disabled="!scope.row.editStatus" v-model="scope.row.is_apply" placeholder="是否适用">
                  <el-option
                    v-for="item in optionsUse"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select>
              </template>
            </el-table-column>

            <el-table-column
              label="说明"
              align="center"
              width="330"
            >
              <template slot-scope="scope" v-if="!scope.row.is_apply">
                <el-input
                 :disabled="!scope.row.editStatus"
                  type="textarea"
                  maxlength="1000"
                  autosize
                  placeholder="请输入说明"
                  v-model="scope.row.not_apply_state">
                </el-input>
              </template>
            </el-table-column>

            <el-table-column
              label="操作"
              align="center"
            >
              <template slot-scope="scope">
                <div>
                  <el-button :disabled="!scope.row.has_perm || scope.row.is_disabled" class="button" size="mini" @click="toEdit('progress_risk', scope.$index)" v-show="!scope.row.editStatus" type="primary" round>编辑</el-button>
                  <el-button class="button" size="mini" @click="saveResult('progress_risk', scope.$index)" v-show="scope.row.editStatus" type="success" round>保存</el-button>
                  <el-button class="button" size="mini" @click="cancel('progress_risk', scope.$index)" v-show="scope.row.editStatus" type="warning" round>取消</el-button>
                </div>
              </template>
            </el-table-column>
          </el-table>
        </el-tab-pane>
        <el-tab-pane label="阶段点风险" name="2">
          <el-table
            :border="true"
            :header-cell-style="{background:'rgb(48, 65, 86)'}"
            :data="result.milestone_risk"
            :row-class-name="tableRowClassName"
            >
            <el-table-column
              label="考核项"
              align="center"
            >
              <template slot-scope="scope">
                <div>
                  <span>{{ scope.row.examine_item }}</span>
                </div>
              </template>
            </el-table-column>
            <el-table-column
              label="责任人"
              align="center"
              prop="owner"
            >
              <template slot-scope="scope">
                <!-- <div v-if="scope.row.editStatus">
                  <el-select v-model="scope.row.owner" placeholder="请选择owner">
                    <el-option
                      v-for="item in scope.row.owner_list"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
                </div> -->
                <div>{{ scope.row.owner.length ? scope.row.owner.map(item => item.label).join(',') : '' }}</div>
              </template>
            </el-table-column>
            <el-table-column
              label="描述"
              align="center"
            >
            <template slot-scope="scope">
              <div v-html="textAreaTo(scope.row.description)"></div>
            </template>
            </el-table-column>
            <el-table-column
              label="目标"
              align="center"
              prop="target_value"
            >
            </el-table-column>

            <el-table-column
              label="数据"
              align="center"
              width="400"
            >
              <template slot-scope="scope">
                <template v-if="!scope.row.is_disabled">
                  <div v-if="scope.row.editStatus">
                    <div v-if="scope.row.type === 'date'">
                      <el-date-picker
                        v-model="scope.row.value"
                        type="date"
                        :disabled="!scope.row.is_apply"
                        format="yyyy 年 MM 月 dd 日"
                        value-format="yyyy-MM-dd"
                        placeholder="请选择日期">
                      </el-date-picker>
                    </div>
                    <div v-else-if="scope.row.type === 'status'">
                      <el-select :disabled="!scope.row.is_apply" v-model="scope.row.value" placeholder="请选择当前状态">
                        <el-option
                          v-for="item in checkAcceptOption"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value"
                          >
                        </el-option>
                      </el-select>
                    </div>
                    <div v-else-if="scope.row.type === 'current_status'">
                      <el-select :disabled="!scope.row.is_apply" v-model="scope.row.value" placeholder="请选择当前状态">
                        <el-option
                          v-for="item in currentAcceptOption"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value"
                          >
                        </el-option>
                      </el-select>
                    </div>
                    <div v-else-if="scope.row.type === 'risk'">
                      <el-select :disabled="!scope.row.is_apply" v-model="scope.row.value" placeholder="请选择风险等级">
                        <el-option
                          v-for="item in riskOption"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value"
                          >
                        </el-option>
                      </el-select>
                    </div>
                    <el-input
                      v-else
                      placeholder="请输入实际值"
                      suffix-icon="el-icon-edit"
                      v-model="scope.row.value"
                      :disabled="!scope.row.is_apply"
                      :type="scope.row.type === 'percent' || scope.row.type === 'number' ? 'number' : 'textarea'"
                      :step="scope.row.type === 'percent' ? '0.1' : ''">
                    </el-input>
                  </div>
                  <div v-else>{{ scope.row.value }}</div>
                </template>

                <template v-else>
                  <div>{{ scope.row.value }}</div>
                  <el-tooltip v-if="scope.row.is_disabled" class="item" effect="light" content="自动获取" placement="top">
                    <div class="auto">系统数据</div>
                  </el-tooltip>
                </template>
              </template>
            </el-table-column>

            <el-table-column
              label="是否适用"
              align="center"
            >
              <template slot-scope="scope">
                <el-select :disabled="!scope.row.editStatus" v-model="scope.row.is_apply" placeholder="是否适用">
                  <el-option
                    v-for="item in optionsUse"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select>
              </template>
            </el-table-column>

            <el-table-column
              label="说明"
              align="center"
              width="330"
            >
              <template slot-scope="scope" v-if="!scope.row.is_apply">
                <el-input
                 :disabled="!scope.row.editStatus"
                  type="textarea"
                  maxlength="1000"
                  autosize
                  placeholder="请输入说明"
                  v-model="scope.row.not_apply_state">
                </el-input>
              </template>
            </el-table-column>

            <el-table-column
              label="操作"
              align="center"
            >
              <template slot-scope="scope">
                <div>
                  <el-button :disabled="!scope.row.has_perm || scope.row.is_disabled" class="button" size="mini" @click="toEdit('milestone_risk', scope.$index)" v-show="!scope.row.editStatus" type="primary" round>编辑</el-button>
                  <el-button class="button" size="mini" @click="saveResult('milestone_risk', scope.$index)" v-show="scope.row.editStatus" type="success" round>保存</el-button>
                  <el-button class="button" size="mini" @click="cancel('milestone_risk', scope.$index)" v-show="scope.row.editStatus" type="warning" round>取消</el-button>
                </div>
              </template>
            </el-table-column>
          </el-table>
        </el-tab-pane>
        <el-tab-pane label="技术风险" name="3">
          <el-table
            :border="true"
            :header-cell-style="{background:'rgb(48, 65, 86)'}"
            :data="result.tech_risk"
            :row-class-name="tableRowClassName"
            >
            <el-table-column
              label="考核项"
              align="center"
            >
              <template slot-scope="scope">
                <div>
                  <span>{{ scope.row.examine_item }}</span>
                </div>
              </template>
            </el-table-column>
            <el-table-column
              label="责任人"
              align="center"
              prop="owner"
            >
              <template slot-scope="scope">
                <!-- <div v-if="scope.row.editStatus">
                  <el-select v-model="scope.row.owner" placeholder="请选择owner">
                    <el-option
                      v-for="item in scope.row.owner_list"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
                </div> -->
                <div v-if="scope.row.owner">{{ scope.row.owner.length ? scope.row.owner.map(item => item.label).join(',') : '' }}</div>
              </template>
            </el-table-column>
            <el-table-column
              label="描述"
              align="center"
              prop="description"
            >
            </el-table-column>
            <el-table-column
              label="目标"
              align="center"
              prop="target_value"
            >
            </el-table-column>

            <el-table-column
              label="数据"
              align="center"
              width="400"
            >
              <template slot-scope="scope">
                <template v-if="!scope.row.is_disabled">
                  <div v-if="scope.row.editStatus">
                    <div v-if="scope.row.type === 'risk'">
                      <el-select :disabled="!scope.row.is_apply" v-model="scope.row.value" placeholder="请选择风险等级">
                        <el-option
                          v-for="item in riskOption"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value"
                          >
                        </el-option>
                      </el-select>
                    </div>
                    <div  v-else-if="scope.row.examine_item === '设计基线率'">
                      <el-input
                        placeholder="请输入分子"
                        suffix-icon="el-icon-edit"
                        v-model="scope.row.molecule"
                        :disabled="!scope.row.is_apply"
                        :type="scope.row.type === 'percent' || scope.row.type === 'number' ? 'number' : ''"
                        :step="scope.row.type === 'percent' ? '0.1' : ''">
                      </el-input>
                      <el-input
                        style="margin-top: 5px;margin-bottom: 5px;"
                        placeholder="请输入分母"
                        suffix-icon="el-icon-edit"
                        v-model="scope.row.denominator"
                        :disabled="!scope.row.is_apply"
                        :type="scope.row.type === 'percent' || scope.row.type === 'number' ? 'number' : ''"
                        :step="scope.row.type === 'percent' ? '0.1' : ''">
                      </el-input>
                      <div >{{ scope.row.value }}</div>
                    </div>
                    <div  v-else-if="scope.row.examine_item === '需求基线率' || scope.row.examine_item === '当前Release需求分解及Task创建进度' || scope.row.examine_item === '当前Release功能组入任务完成率' || scope.row.examine_item === '需求缺陷漏出率' || scope.row.examine_item === '设计缺陷漏出率'">
                      <el-input
                        placeholder="请输入分子"
                        suffix-icon="el-icon-edit"
                        v-model="scope.row.molecule"
                        :disabled="!scope.row.is_apply"
                        :type="scope.row.type === 'percent' || scope.row.type === 'number' ? 'number' : ''"
                        :step="scope.row.type === 'percent' ? '0.1' : ''">
                      </el-input>
                      <div style="margin-top: 5px;margin-bottom: 5px;">{{ scope.row.denominator }}</div>
                      <div>{{ scope.row.value }}</div>
                    </div>
                    <div v-else>
                      <el-input
                        placeholder="请输入实际值"
                        suffix-icon="el-icon-edit"
                        v-model="scope.row.value"
                        :disabled="!scope.row.is_apply"
                        :type="scope.row.type === 'percent' || scope.row.type === 'number' ? 'number' : ''"
                        :step="scope.row.type === 'percent' ? '0.1' : ''">
                      </el-input>
                    </div>
                  </div>

                  <div v-else>
                    {{ scope.row.value }}
                  </div>
                </template>

                <template v-else>
                  <div>{{ scope.row.value }}</div>
                  <el-tooltip v-if="scope.row.is_disabled" class="item" effect="light" content="自动获取" placement="top">
                    <div class="auto">系统数据</div>
                  </el-tooltip>
                </template>
              </template>
            </el-table-column>

            <el-table-column
              label="是否适用"
              align="center"
            >
              <template slot-scope="scope">
                <el-select :disabled="!scope.row.editStatus" v-model="scope.row.is_apply" placeholder="是否适用">
                  <el-option
                    v-for="item in optionsUse"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select>
              </template>
            </el-table-column>

            <el-table-column
              label="说明"
              align="center"
              width="330"
            >
              <template slot-scope="scope" v-if="!scope.row.is_apply">
                <el-input
                 :disabled="!scope.row.editStatus"
                  type="textarea"
                  maxlength="1000"
                  autosize
                  placeholder="请输入说明"
                  v-model="scope.row.not_apply_state">
                </el-input>
              </template>
            </el-table-column>

            <el-table-column
              label="操作"
              align="center"
            >
              <template slot-scope="scope">
                <div>
                  <el-button :disabled="!scope.row.has_perm || scope.row.is_disabled" class="button" size="mini" @click="toEdit('tech_risk', scope.$index)" v-show="!scope.row.editStatus" type="primary" round>编辑</el-button>
                  <el-button class="button" size="mini" @click="saveResult('tech_risk', scope.$index)" v-show="scope.row.editStatus" type="success" round>保存</el-button>
                  <el-button class="button" size="mini" @click="cancel('tech_risk', scope.$index)" v-show="scope.row.editStatus" type="warning" round>取消</el-button>
                </div>
              </template>
            </el-table-column>
          </el-table>
        </el-tab-pane>
        <el-tab-pane label="质量风险" name="4">
          <el-table
            :border="true"
            :header-cell-style="{background:'rgb(48, 65, 86)'}"
            :data="result.quality_risk"
            :row-class-name="tableRowClassName"
            >
            <el-table-column
              label="考核项"
              align="center"
            >
              <template slot-scope="scope">
                <div>
                  <span>{{ scope.row.examine_item }}</span>
                </div>
              </template>
            </el-table-column>
            <el-table-column
              label="责任人"
              align="center"
              prop="owner"
            >
              <template slot-scope="scope">
                <!-- <div v-if="scope.row.editStatus">
                  <el-select v-model="scope.row.owner" placeholder="请选择owner">
                    <el-option
                      v-for="item in scope.row.owner_list"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
                </div> -->
                <div>{{ scope.row.owner.length ? scope.row.owner.map(item => item.label).join(',') : '' }}</div>
              </template>
            </el-table-column>
            <el-table-column
              label="描述"
              align="center"
              prop="description"
            >
            </el-table-column>
            <el-table-column
              label="目标"
              align="center"
              prop="target_value"
            >
            </el-table-column>

            <el-table-column
              label="数据"
              align="center"
              width="400"
            >
              <template slot-scope="scope">
                <template v-if="!scope.row.is_disabled">
                  <div v-if="scope.row.editStatus">
                    <div v-if="scope.row.type === 'risk'">
                      <el-select :disabled="!scope.row.is_apply" v-model="scope.row.value" placeholder="请选择风险等级">
                        <el-option
                          v-for="item in riskOption"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value"
                          >
                        </el-option>
                      </el-select>
                    </div>
                    <el-input
                      v-else
                      placeholder="请输入实际值"
                      suffix-icon="el-icon-edit"
                      v-model="scope.row.value"
                      :disabled="!scope.row.is_apply"
                      :type="scope.row.type === 'percent' || scope.row.type === 'number' ? 'number' : ''"
                      :step="scope.row.type === 'percent' ? '0.1' : ''">
                    </el-input>
                  </div>
                  <div v-else>{{ scope.row.value }}</div>
                </template>

                <template v-else>
                  <div>{{ scope.row.value }}</div>
                  <el-tooltip v-if="scope.row.is_disabled" class="item" effect="light" content="自动获取" placement="top">
                    <div class="auto">系统数据</div>
                  </el-tooltip>
                </template>
              </template>
            </el-table-column>

            <el-table-column
              label="是否适用"
              align="center"
            >
              <template slot-scope="scope">
                <el-select :disabled="!scope.row.editStatus" v-model="scope.row.is_apply" placeholder="是否适用">
                  <el-option
                    v-for="item in optionsUse"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select>
              </template>
            </el-table-column>

            <el-table-column
              label="说明"
              align="center"
              width="330"
            >
              <template slot-scope="scope" v-if="!scope.row.is_apply">
                <el-input
                 :disabled="!scope.row.editStatus"
                  type="textarea"
                  maxlength="1000"
                  autosize
                  placeholder="请输入说明"
                  v-model="scope.row.not_apply_state">
                </el-input>
              </template>
            </el-table-column>

            <el-table-column
              label="操作"
              align="center"
            >
              <template slot-scope="scope">
                <div>
                  <el-button :disabled="!scope.row.has_perm || scope.row.is_disabled" class="button" size="mini" @click="toEdit('quality_risk', scope.$index)" v-show="!scope.row.editStatus" type="primary" round>编辑</el-button>
                  <el-button class="button" size="mini" @click="saveResult('quality_risk', scope.$index)" v-show="scope.row.editStatus" type="success" round>保存</el-button>
                  <el-button class="button" size="mini" @click="cancel('quality_risk', scope.$index)" v-show="scope.row.editStatus" type="warning" round>取消</el-button>
                </div>
              </template>
            </el-table-column>
          </el-table>
        </el-tab-pane>
        <el-tab-pane label="客户满意度" name="5">
          <el-table
            :border="true"
            :header-cell-style="{background:'rgb(48, 65, 86)'}"
            :data="result.customer_satisfaction"
            :row-class-name="tableRowClassName"
            >
            <el-table-column
              label="考核项"
              align="center"
            >
              <template slot-scope="scope">
                <div>
                  <span>{{ scope.row.examine_item }}</span>
                </div>
              </template>
            </el-table-column>
            <el-table-column
              label="责任人"
              align="center"
              prop="owner"
            >
              <template slot-scope="scope">
                <!-- <div v-if="scope.row.editStatus">
                  <el-select v-model="scope.row.owner" placeholder="请选择owner">
                    <el-option
                      v-for="item in scope.row.owner_list"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value">
                    </el-option>
                  </el-select>
                </div> -->
                <div>{{ scope.row.owner.length ? scope.row.owner.map(item => item.label).join(',') : '' }}</div>
              </template>
            </el-table-column>
            <el-table-column
              label="描述"
              align="center"
              prop="description"
            >
            </el-table-column>
            <el-table-column
              label="目标"
              align="center"
              prop="target_value"
            >
            </el-table-column>

            <el-table-column
              label="数据"
              align="center"
              width="400"
            >
              <template slot-scope="scope">
                <template v-if="!scope.row.is_disabled">
                  <div v-if="scope.row.editStatus">
                    <div v-if="scope.row.type === 'risk'">
                      <el-select :disabled="!scope.row.is_apply" v-model="scope.row.value" placeholder="请选择风险等级">
                        <el-option
                          v-for="item in riskOption"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value"
                          >
                        </el-option>
                      </el-select>
                    </div>
                    <el-input
                      v-else
                      placeholder="请输入实际值"
                      suffix-icon="el-icon-edit"
                      v-model="scope.row.value"
                      :disabled="!scope.row.is_apply"
                      :type="scope.row.type === 'percent' || scope.row.type === 'number' ? 'number' : ''"
                      :step="scope.row.type === 'percent' ? '0.1' : ''">
                    </el-input>
                  </div>
                  <div v-else>{{ scope.row.value }}</div>
                </template>

                <template v-else>
                  <div>{{ scope.row.value }}</div>
                  <el-tooltip v-if="scope.row.is_disabled" class="item" effect="light" content="自动获取" placement="top">
                    <div class="auto">系统数据</div>
                  </el-tooltip>
                </template>
              </template>
            </el-table-column>

            <el-table-column
              label="是否适用"
              align="center"
            >
              <template slot-scope="scope">
                <el-select :disabled="!scope.row.editStatus" v-model="scope.row.is_apply" placeholder="是否适用">
                  <el-option
                    v-for="item in optionsUse"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select>
              </template>
            </el-table-column>

            <el-table-column
              label="说明"
              align="center"
              width="330"
            >
              <template slot-scope="scope" v-if="!scope.row.is_apply">
                <el-input
                 :disabled="!scope.row.editStatus"
                  type="textarea"
                  maxlength="1000"
                  autosize
                  placeholder="请输入说明"
                  v-model="scope.row.not_apply_state">
                </el-input>
              </template>
            </el-table-column>

            <el-table-column
              label="操作"
              align="center"
            >
              <template slot-scope="scope">
                <div>
                  <el-button :disabled="!scope.row.has_perm || scope.row.is_disabled" class="button" size="mini" @click="toEdit('customer_satisfaction', scope.$index)" v-show="!scope.row.editStatus" type="primary" round>编辑</el-button>
                  <el-button class="button" size="mini" @click="saveResult('customer_satisfaction', scope.$index)" v-show="scope.row.editStatus" type="success" round>保存</el-button>
                  <el-button class="button" size="mini" @click="cancel('customer_satisfaction', scope.$index)" v-show="scope.row.editStatus" type="warning" round>取消</el-button>
                </div>
              </template>
            </el-table-column>
          </el-table>
        </el-tab-pane>
        <el-tab-pane label="商务风险" name="6">
          <el-table
            :border="true"
            :header-cell-style="{background:'rgb(48, 65, 86)'}"
            :data="result.commerce_risk"
            style="width: 90%"
            :row-class-name="tableRowClassName"
            >
            <el-table-column
              label="考核项"
              align="center"
            >
              <template slot-scope="scope">
                <div>
                  <span>{{ scope.row.examine_item }}</span>
                </div>
              </template>
            </el-table-column>
            <el-table-column
              label="责任人"
              align="center"
              prop="owner"
            >
              <template slot-scope="scope">
                <div>{{ scope.row.owner.length ? scope.row.owner.map(item => item.label).join(',') : '' }}</div>
              </template>
            </el-table-column>
            <el-table-column
              label="描述"
              align="center"
              prop="description"
            >
            </el-table-column>
            <el-table-column
              label="目标"
              align="center"
              prop="target_value"
            >
            </el-table-column>

            <el-table-column
              label="数据"
              align="center"
              width="400"
            >
              <template slot-scope="scope">
                <div v-if="scope.row.editStatus">
                  <div v-if="scope.row.type === 'risk'">
                      <el-select :disabled="!scope.row.is_apply" v-model="scope.row.value" placeholder="请选择风险等级">
                        <el-option
                          v-for="item in riskOption"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value"
                          >
                        </el-option>
                      </el-select>
                  </div>
                  <el-input
                    v-else
                    placeholder="请选择实际值"
                    suffix-icon="el-icon-edit"
                    v-model="scope.row.value">
                  </el-input>
                </div>
                <div v-else>
                {{ scope.row.value }}
                <el-tooltip v-if="scope.row.is_disabled" class="item" effect="light" content="自动获取" placement="top">
                  <div class="auto">系统数据</div>
                </el-tooltip>
                </div>
              </template>
            </el-table-column>
          </el-table>
        </el-tab-pane>
        <el-tab-pane label="成本风险" name="7">
          <el-table
            :border="true"
            :header-cell-style="{background:'rgb(48, 65, 86)'}"
            :data="result.cost"
            style="width: 90%"
            :row-class-name="tableRowClassName"
            >
            <el-table-column
              label="考核项"
              align="center"
            >
              <template slot-scope="scope">
                <div>
                  <span>{{ scope.row.examine_item }}</span>
                </div>
              </template>
            </el-table-column>
            <el-table-column
              label="责任人"
              align="center"
              prop="owner"
            >
              <template slot-scope="scope">
                <div>{{ scope.row.owner.length ? scope.row.owner.map(item => item.label).join(',') : '' }}</div>
              </template>
            </el-table-column>
            <el-table-column
              label="描述"
              align="center"
              prop="description"
            >
            </el-table-column>
            <el-table-column
              label="目标"
              align="center"
              prop="target_value"
            >
            </el-table-column>

            <el-table-column
              label="数据"
              align="center"
              width="400"
            >
              <template slot-scope="scope">
                <div v-if="scope.row.editStatus">
                  <div v-if="scope.row.type === 'risk'">
                    <el-select :disabled="!scope.row.is_apply" v-model="scope.row.value" placeholder="请选择风险等级">
                      <el-option
                        v-for="item in riskOption"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value"
                        >
                      </el-option>
                    </el-select>
                  </div>
                  <el-input
                    v-else
                    placeholder="请选择实际值"
                    suffix-icon="el-icon-edit"
                    v-model="scope.row.value">
                  </el-input>
                </div>
                <div v-else>
                {{ scope.row.value }}
                <el-tooltip v-if="scope.row.is_disabled" class="item" effect="light" content="自动获取" placement="top">
                  <div class="auto">系统数据</div>
                </el-tooltip>
                </div>
              </template>
            </el-table-column>
          </el-table>
        </el-tab-pane>
        <el-tab-pane label="周报状态设置" name="9">
          <el-table
            :border="true"
            :header-cell-style="{background:'rgb(48, 65, 86)'}"
            :data="result.current_week_status"
            :row-class-name="tableRowClassName"
            >
            <el-table-column
              label="考核项"
              align="center"
            >
              <template slot-scope="scope">
                <div>
                  <span>{{ scope.row.examine_item }}</span>
                </div>
              </template>
            </el-table-column>
            <el-table-column
              label="责任人"
              align="center"
              prop="owner"
            >
              <template slot-scope="scope">
                <div>{{ scope.row.owner.length ? scope.row.owner.map(item => item.label).join(',') : '' }}</div>
              </template>
            </el-table-column>
            <el-table-column
              label="描述"
              align="center"
              prop="description"
            >
            </el-table-column>
            <el-table-column
              label="目标"
              align="center"
              prop="target_value"
            >
            </el-table-column>
            <el-table-column
              label="是否适用"
              align="center"
            >
              <template slot-scope="scope">
                <el-select :disabled="!scope.row.editStatus" v-model="scope.row.is_apply" placeholder="是否适用">
                  <el-option
                    v-for="item in optionsUse"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select>
              </template>
            </el-table-column>

            <el-table-column
              label="说明"
              align="center"
              width="330"
            >
              <template slot-scope="scope" v-if="!scope.row.is_apply">
                <el-input
                 :disabled="!scope.row.editStatus"
                  type="textarea"
                  maxlength="1000"
                  autosize
                  placeholder="请输入说明"
                  v-model="scope.row.not_apply_state">
                </el-input>
              </template>
            </el-table-column>

            <el-table-column
              label="操作"
              align="center"
            >
              <template slot-scope="scope">
                <div>
                  <el-button :disabled="!scope.row.has_perm || scope.row.is_disabled" class="button" size="mini" @click="toEdit('current_week_status', scope.$index)" v-show="!scope.row.editStatus" type="primary" round>编辑</el-button>
                  <el-button class="button" size="mini" @click="saveResult('current_week_status', scope.$index)" v-show="scope.row.editStatus" type="success" round>保存</el-button>
                  <el-button class="button" size="mini" @click="cancel('current_week_status', scope.$index)" v-show="scope.row.editStatus" type="warning" round>取消</el-button>
                </div>
              </template>
            </el-table-column>
          </el-table>
        </el-tab-pane>
        <!-- <el-tab-pane label="BU自评" name="8">
          <el-table
            :border="true"
            :header-cell-style="{background:'rgb(48, 65, 86)'}"
            :data="result.self_assessment"
            style="width: 90%;"
            >
            <el-table-column
              label="考核项"
              align="center"
            >
              <template slot-scope="scope">
                <div>
                  <span>{{ scope.row.examine_item }}</span>
                </div>
              </template>
            </el-table-column>
            <el-table-column
              label="责任人"
              align="center"
              prop="owner"
            >
              <template slot-scope="scope">
                <div>{{ scope.row.owner.length ? scope.row.owner.map(item => item.label).join(',') : '' }}</div>
              </template>
            </el-table-column>
            <el-table-column
              label="描述"
              align="center"
              prop="description"
            >
            </el-table-column>

            <el-table-column
              label="数据"
              align="center"
              width="400"
            >
              <template slot-scope="scope">
                <template v-if="!scope.row.is_disabled">
                  <div v-if="scope.row.editStatus">
                    <div v-if="scope.row.type === 'date'">
                      <el-date-picker
                        v-model="scope.row.value"
                        type="date"
                        format="yyyy 年 MM 月 dd 日"
                        value-format="yyyy-MM-dd"
                        placeholder="请选择日期">
                      </el-date-picker>
                    </div>
                    <el-input
                      v-else
                      placeholder="请输入实际值"
                      suffix-icon="el-icon-edit"
                      v-model="scope.row.value"
                      :type="scope.row.type === 'percent' || scope.row.type === 'number' ? 'number' : ''"
                      :step="scope.row.type === 'percent' ? '0.1' : ''">
                    </el-input>
                  </div>
                  <div v-else>{{ scope.row.value }}</div>
                </template>

                <template v-else>
                  <div>{{ scope.row.value }}</div>
                  <el-tooltip v-if="scope.row.is_disabled" class="item" effect="light" content="自动获取" placement="top">
                    <div class="auto">系统数据</div>
                  </el-tooltip>
                </template>
              </template>
            </el-table-column>

            <el-table-column
              label="是否适用"
              align="center"
            >
              <template slot-scope="scope">
                <el-select :disabled="!scope.row.editStatus" v-model="scope.row.is_apply" placeholder="是否适用">
                  <el-option
                    v-for="item in optionsUse"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value">
                  </el-option>
                </el-select>
              </template>
            </el-table-column>

            <el-table-column
              label="说明"
              align="center"
              width="330"
            >
              <template slot-scope="scope" v-if="!scope.row.is_apply">
                <el-input
                 :disabled="!scope.row.editStatus"
                  type="textarea"
                  maxlength="50"
                  autosize
                  placeholder="请输入说明"
                  v-model="scope.row.not_apply_state">
                </el-input>
              </template>
            </el-table-column>

            <el-table-column
              label="操作"
              align="center"
            >
              <template slot-scope="scope">
                <div>
                  <el-button :disabled="!scope.row.has_perm || scope.row.is_disabled" class="button" size="mini" @click="toEdit('self_assessment', scope.$index)" v-show="!scope.row.editStatus" type="primary" round>编辑</el-button>
                  <el-button class="button" size="mini" @click="saveResult('self_assessment', scope.$index)" v-show="scope.row.editStatus" type="success" round>保存</el-button>
                  <el-button class="button" size="mini" @click="cancel('self_assessment', scope.$index)" v-show="scope.row.editStatus" type="warning" round>取消</el-button>
                </div>
              </template>
            </el-table-column>
          </el-table>
        </el-tab-pane> -->
      </el-tabs>
    </div>
    <!--<el-table-column
              label="操作"
              align="center"
            >
              <template slot-scope="scope">
                <div>
                  <el-button class="button" size="mini" @click="toEdit('cost', scope.$index)" v-show="!scope.row.editStatus" type="primary" round>编辑</el-button>
                  <el-button class="button" size="mini" @click="saveResult('cost', scope.$index)" v-show="scope.row.editStatus" type="success" round>保存</el-button>
                  <el-button class="button" size="mini" @click="cancel('cost', scope.$index)" v-show="scope.row.editStatus" type="warning" round>取消</el-button>
                </div>
              </template>
            </el-table-column> -->
  </div>
</template>

<script>
  import VTitle from '@/views/sys/internetThings/title'
  import VCondition from '@/views/data/carDispose/group'
  // import VUnit from '../unit'
  import { mapState } from 'vuex'
  import http from '@/views/sys/axios'

  export default {
    name: 'CarSupplement',
    components: {
      VTitle,
      VCondition
      // VUnit
    },
    computed: {
      ...mapState({
        dispose: state => state.conditions.dispose
      }),
      // baseTable() {
      //   let res = Object.keys(this.result)
      //   let resFilter = res.filter(key => key === 'base_info')
      //   if(resFilter.length) {
      //     return Object.keys(this.result.base_info[0])
      //   } else {
      //     return []
      //   }
      // }
    },
    data() {
      return {
        description:'',
        allKey:[],
        input:[],
        value:'',
        values:'',
        input: '',
        tmpVal1:[],
        options1:[
          {
          value: 1,
          label: '是',
        },
        {
          value: 2,
          label: '否',
        },
        {
          value: 3,
          label: '其他',
        }],
        edit: false,
        activeName: '7',
        result: {},
        title: '',
        riskOption: [
          {
            value: '高风险',
            label: '高风险'
          },
          {
            value: '中风险',
            label: '中风险'
          },
          {
            value: '低风险',
            label: '低风险'
          }
        ],
        centerOptions: [
          {
            value: '北京',
            label: '北京'
          },
          {
            value: '大连',
            label: '大连'
          },
          {
            value: '南京',
            label: '南京'
          },
          {
            value: '成都',
            label: '成都'
          },
          {
            value: '沈阳',
            label: '沈阳'
          },
          {
            value: '郡码',
            label: '郡码'
          },{
            value: '重庆',
            label: '重庆'
          }
        ],
        fullLoading: false,
        options: [],
        loading: false,
        currentAcceptOption: [
          {
            value: '未开始',
            label: '未开始'
          },
          {
            value: '未开始（延期）',
            label: '未开始（延期）'
          },
          {
            value: '进行中',
            label: '进行中'
          },
          {
            value: '进行中(延期）',
            label: '进行中(延期）'
          },
          {
            value: '已结束',
            label: '已结束'
          },
          {
            value: '已结束(延期）',
            label: '已结束(延期）'
          },
          {
            value: '变更中',
            label: '变更中'
          },
          {
            value: '变更中(延期) ',
            label: '变更中(延期) '
          },
          {
            value: '已取消',
            label: '已取消'
          }
        ],
        checkAcceptOption: [
          {
            value: '按期已验收',
            label: '按期已验收'
          },
          {
            value: '逾期已验收',
            label: '逾期已验收'
          },
          {
            value: '未验收',
            label: '未验收'
          },
          {
            value: '逾期未验收',
            label: '逾期未验收'
          }
        ],
        optionsUse: [
          {
            value: true,
            label: '是'
          },
          {
            value: false,
            label: '否'
          }
        ]
      }
    },
    mounted() {

      this.$nextTick(() => {
        if(this.dispose.projectId) {
          this.getTableResult()
        }
      })
    },
    methods: {
        toSave(key, index) {
          const { name, value, description } = this.result[key][index]
          const data =
            {
              name,
              value:this.value,
              description
              }
          if( name === '需求管理方式 (PMS或者其他需求管理平台)' || name === '管理方法' || name === '设计文档裁剪结果' ){
            data.value = ''
          }
          if((this.value[0] === "否" && description === '') && name != '设计文档裁剪结果' && name != '架构设计文档'&& name != '概要设计文档'&& name != '详细设计文档'){
            return Promise.resolve({
              code: 202,
              msg: '请先填写说明',
            })
          }
          return http.post(`/api/data_summary/car/project/info/${this.dispose.projectId}/`,data)

       },

      async saveResult1(key, index) {
        try {
          const { code , msg } = await this.toSave(key, index)
              if(code === 200 ) {
                this.cancel(key, index)
                this.$message({
                  showClose: true,
                  message: '保存成功!',
                  type: 'success'
                })
            } else if(code === 400) {
              this.$message({
                showClose: true,
                message: msg,
                type: 'error'
              })
            } else {
              this.$message({
                showClose: true,
                message: "请先填写说明",
                type: 'error'
              })
            }
        }catch(err){
            throw new Error(err)
          }
       },
        chengeselectFn(e,index,row){
          if(e=='1'){
            this.value=''
            this.value='是'
            row.value = '是'
          }else if(e=='2'){
            this.value=''
            this.value='否'
            row.value = '否'
          }else if(e=='3'){
            this.value=''
            this.value='其他'
            row.value = '其他'
          }
          this.$set(result.project_info,index,row)
        },

      // 项目基础信息
      objectSpanMethod2({ row, column, rowIndex, columnIndex }){
         if (columnIndex === 0) {
          if (rowIndex === 0 ) {
            return {
              rowspan: 6,
              colspan: 1
            };
          } else if( rowIndex === 6 ){
              return {
              rowspan: 9,
              colspan: 1
            }
          }else {
                return {
                  rowspan: 0,
                  colspan: 0
                };
              }
        }
      },
      textAreaTo(str) {
        let regs = new RegExp('\r', 'g');
        let reg = new RegExp("\n", 'g');
        str = str.replace(reg, "<br/>");
        str = str.replace(regs, "<br/>");
        return str
      },
      disable(item) {
        return item === '项目' ||
          item === '立项事业部' ||
          item === 'PM' ||
          item === '立项/变更的最新日期' ||
          item === '项目开始时间' ||
          item === '项目结束时间'
      },
      back() {
        this.$router.go(-1)
      },
      tableRowClassName({row, rowIndex}) {
        if(row.is_disabled) {
          return 'beauty'
        }
        // return ''
      },
      toEdit(key, index) {
        let reg = new RegExp(',' , "g")
        let resVal = this.result[key][index].value
        if(this.result[key][index].type === 'sums') {
          if (resVal.indexOf(',') > 0) {
            resVal = resVal.replace(reg, '')
            this.$set(this.result[key][index], 'value', resVal)
          }
        }
        // if(key === 'base_info') {
        //   let resObj = this.result[key][index]
        //   Object.keys(resObj).forEach(item => {
        //     let resVal = resObj[item].value
        //     if(resObj[item].type === 'sums') {
        //       resVal = resVal.replace(reg, '')
        //       this.$set(this.result[key][index][item], 'value', resVal)
        //     }
        //   })
        // } else {
        // }
        this.result[key].map((v,i) => {
          if(i == index) {
            v.editStatus = true
          } else {
            v.editStatus = false
          }
        })
      },
      cancel(key, index) {
        this.result[key][index].editStatus = false
        this.getTableResult()
      },
      change(val) {
        this.options = []
      },
      async remoteMethod(query) {
        if (query !== '') {
          this.loading = true;
          this.options = []
          this.getStateResult(query)
        } else {
          this.options = [];
        }
      },
      getStates(name) {
        return http.get(`/api/account/user/query?name=${name}`)
      },
      async getStateResult(name) {
        try {
          const { code, user_list } = await this.getStates(name)
          if(code === 200) {
            this.loading = false
            this.options = user_list
          }
        } catch (err) {
          throw new Error(err)
        }
      },
      save(key, index) {
        let keng, actualValue
        let reg = new RegExp(',' , "g")
        const { examine_item, owner, value, type, is_apply, not_apply_state, denominator, molecule } = this.result[key][index]
        console.log(1,this.result[key].length - 1)
        if(!is_apply && not_apply_state == '') {
          return Promise.resolve({
            code: 202,
            msg: '请先填写说明'
          })
        }
        if(key != 'current_week_status' && this.result[key][index].value !== "低风险"  && index != 0 && this.result[key][index-1].value == '' && index == this.result[key].length - 1 ) {
          return false
        }
        // if(key === 'base_info') {
        //   keng = Object.keys(this.result['base_info'][0]).map(key => {
        //     return {
        //       [key]: this.result['base_info'][0][key].type === 'percent'
        //       ?
        //       (this.result['base_info'][0][key].value.indexOf('%') > 0 ? this.result['base_info'][0][key].value : this.result['base_info'][0][key].value + '%' )
        //       :
        //       this.result['base_info'][0][key].type === 'sums'
        //       ?
        //       (this.result['base_info'][0][key].value.indexOf(',') > 0 ? this.result['base_info'][0][key].value.replace(reg, '') : this.result['base_info'][0][key].value)
        //       :
        //       this.result['base_info'][0][key].value
        //     }
        //   })
        //   keng = Object.assign({}, ...keng)
        //   let center
        //   if(this.result['base_info'][0].hasOwnProperty('交付中心')) {
        //     center = this.result['base_info'][0]['交付中心'].value.length && this.result['base_info'][index]['交付中心'].value.join(',')
        //     keng['交付中心'] = center || ''
        //   }
        // } else {

        // }
        actualValue = value
        if(!denominator){
          if(examine_item === '交付中心') {
            actualValue = actualValue.length && actualValue.join(',')
          }

          if(type === 'percent') {
            if(actualValue.indexOf('%') < 0) {
              actualValue = actualValue !== '' ? value + '%' : ''
            }
          } else if(type === 'sums') {
            actualValue.indexOf(',') > 0 ? actualValue = actualValue.replace(reg, '') : actualValue
          }
        }else {
          let tmp = molecule/denominator
          let num = 100
          actualValue = Number(tmp*num).toFixed(2) + `%`
        }

        // actualValue = value
        // console.log("value",value)
        // if(examine_item === '交付中心') {
        //   actualValue = actualValue.length && actualValue.join(',')
        // }

        // if(type === 'percent') {
        //   if(actualValue.indexOf('%') < 0) {
        //     actualValue = actualValue !== '' ? value + '%' : ''
        //   }
        // } else if(type === 'sums') {
        //   actualValue.indexOf(',') > 0 ? actualValue = actualValue.replace(reg, '') : actualValue
        // }

        // tmpDenominator = denominator
        // console.log("denominator",denominator)
        const data =
        {[key]: {
          examine_item,
          actual_value: actualValue,
          is_apply,
          not_apply_state,
          denominator,
          molecule
        }}
        return http.post(`/api/data_summary/car/project/entry?projectId=${this.dispose.projectId}`, data)
      },
      async saveResult(key, index) {
        try {
          const { code, msg } = await this.save(key, index)
          if(code === 200 ) {
              this.cancel(key, index)
              this.$message({
                showClose: true,
                message: '保存成功!',
                type: 'success'
              })
          } else if(code === 202) {
            this.$message({
              showClose: true,
              message: msg,
              type: 'error'
            })
          } else {
            this.$message({
              showClose: true,
              message: "必须填写风险原因",
              type: 'error'
            })
          }
        } catch(err) {
          throw new Error(err)
        }
      },
      getTable() {
        return http.get(`/api/data_summary/car/project/entry?projectId=${this.dispose.projectId}`)
      },
      async getTableResult() {
        try {
          this.fullLoading = true
          const { code, result, project_name } = await this.getTable()
          // console.log(45,result)
          if(code === 200) {
            result.project_info.forEach(info => {
              this.allKey.push(info.name)
            })
            this.result = result
            this.title = project_name
            this.fullLoading = false

            let item
            this.result['base_info'].forEach(info => {
              if(info.examine_item === '交付中心') {
                item = info.value
                if(item) {
                  item.indexOf(',') !== -1
                  ?
                  info.value = item.split(',')
                  :
                  info.value = [item]
                }
              }
            })

            // if(item) {
            //   item.indexOf(',') !== -1
            //   ?
            //   this.result['base_info'][0]['交付中心'].value = item.split(',')
            //   :
            //   this.result['base_info'][0]['交付中心'].value = [item]
            // }
            Object.keys(result).forEach(key => {
              result[key].forEach(item => {
                this.$set(item, 'editStatus', false)
              })
            })
          }
        } catch(err) {
          throw new Error(err)
          this.fullLoading = false
        }
      }
    },
    watch: {
      dispose: {
        handler: function(newVal) {
          if(newVal) {
            this.getTableResult()
          }
        },
        deep: true
      }
    }
  }
</script>

<style lang="scss" scoped>
  /deep/ .el-table thead {
    color: #fff;
  }
  /deep/ .el-table th.gutter{
    display: table-cell!important;
  }
  /deep/ .el-card__body{
    display: flex;
    height: 85px;
  }
  /deep/ .el-badge{
    width: 100%;
  }
  /deep/ .el-badge__content.is-fixed{
    top: 12px;
    right: 63px;
    height: 24px;
    line-height: 22px;
  }
  .back{
    position: fixed;
    top: 45px;
    left: 20px;
    z-index: 9999;
  }
  .title{
    margin-left: 50px;
  }
  // /deep/ .el-table .beauty{
  //   background: -moz-linear-gradient(left,  rgba(40,52,45,1) 0%, rgba(130,140,139,1) 36%, rgba(40,52,59,1) 100%); /* FF3.6-15 */
  //   background: -webkit-linear-gradient(left,  rgba(40,52,45,1) 0%,rgba(130,140,139,1) 36%,rgba(40,52,59,1) 100%); /* Chrome10-25,Safari5.1-6 */
  //   background: linear-gradient(to right,  rgba(40,52,45,1) 0%,rgba(130,140,139,1) 36%,rgba(40,52,59,1) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
  //   // background: -moz-linear-gradient(left, rgba(89,106,114,1) 0%, rgba(206,220,231,1) 100%); /* FF3.6-15 */
  //   // background: -webkit-linear-gradient(left, rgba(89,106,114,1) 0%, rgba(206,220,231,1) 100%); /* Chrome10-25,Safari5.1-6 */
  //   // background: linear-gradient(to right, rgba(89,106,114,1) 0%, rgba(206,220,231,1) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
  //   color: #fff;
  // }
  // /deep/ .el-table .beauty:hover{
  //   background: -moz-linear-gradient(left, rgba(89,106,114,1) 0%, rgba(206,220,231,1) 100%); /* FF3.6-15 */
  //   background: -webkit-linear-gradient(left, rgba(89,106,114,1) 0%, rgba(206,220,231,1) 100%); /* Chrome10-25,Safari5.1-6 */
  //   background: linear-gradient(to right, rgba(89,106,114,1) 0%, rgba(206,220,231,1) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
  //   color: #999;
  // }
  #car-supplement{
    padding: 32px;
    background-color: rgb(240, 242, 245);
    position: relative;
    .btn-group{
      text-align: right;
    }
    .relative{
      position: relative;
      .marginItem{
        margin-top: 10px;
        .form-inline{
          font-size: 12px;
          .title {
            margin: auto 0;
          }
          .flex-inline{
            margin: auto 0;
            margin-left: 10px;
            color: #999;
            .must{
              position: absolute;
              right: 0;
              top: 8px;
              width: 20px;
              height: 20px;
              line-height: 20px;
              color: #e4393c;
              font-size: 22px;
              font-weight: bold;
            }
          }
        }
      }
      .baseButton{
        position: absolute;
        top: -30px;
        right: 20px;
      }
    }

  }
  .marT{
      margin-top: 20px;
  }
  /deep/ .el-table__body-wrapper{
    overflow: initial;
  }
  .auto{
    color: #fff;
    background: #e4393c;
    width: 85px;
    text-align: center;
    height: 28px;
    font-size: 12px;
    line-height: 28px;
    padding: 0 5px;
    border-radius: 20px;
    cursor: pointer;
    margin: auto;
    position: absolute;
    top: -8px;
    left: 328px;
    transform: scale(.85);
    z-index: 100;
  }
</style>
